package com.it.shiro.sys.service.impl;



import com.it.base.service.impl.BaseService;
import com.it.shiro.sys.entity.User;
import com.it.shiro.sys.mapper.UserMapper;
import com.it.shiro.sys.service.IUserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;


/**
 * @program: learning
 * @description:
 * @author: Lefnmg
 * @create: 2018-11-02 23:32
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class UserService extends BaseService<User, UserMapper> implements IUserService {

    @Cacheable(value = "test", key = "#id")
    @Override
    public User findById(Long id) {
        return baseMapper.findById(id);
    }

    @Cacheable(value = "test",key="'list'")
    @Override
    public <S extends User> List<User> findList(S s) {
        return baseMapper.findList(s);
    }

    @Override
    @Cacheable(value = "test",key="#username+'Permissions'")
    public List<String> findPermissionsByUsername(String username) {
        return baseMapper.findPermissionsByUsername(username);
    }
}
